<template>
  <div>
    <Button @click="playArm">语言播放</Button>
  </div>
</template>

<script>
export default {
  name: 'voice',
  data () {
    return {
    }
  },
  methods: {
    playArm () {
      let amr = new this.AMRRecorder()
      if (typeof this.mediaId === 'string') {
        amr.initWithUrl('https://www.gztang.cn/wx/material/' + this.mediaId).then(() => {
          amr.play()
        })
      } else {
        amr.initWithBlob(this.mediaId).then(() => {
          amr.play()
        })
      }
      amr.onEnded(() => {
        this.$Message.success('播放完毕')
      })
    }
  },
  props: ['mediaId', 'AMRRecorder'],
  created () {
    // console.log(this.AMRRecorder)
  }
}
</script>

<style scoped>

</style>
